Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/set-cookie-parser

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/set-cookie-parser

TypeScript definitions for set-cookie-parser

  • 2.4.10
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8M
increased by8.86%
Maintainers
1
Weekly downloads
 
Created

What is @types/set-cookie-parser?

The @types/set-cookie-parser package provides TypeScript type definitions for the set-cookie-parser package, which is a library for parsing and splitting the Set-Cookie headers into individual cookie objects. It is useful for developers who use TypeScript and want to ensure type safety when working with cookies in HTTP responses.

What are @types/set-cookie-parser's main functionalities?

Parsing Set-Cookie headers

This feature allows you to parse the content of Set-Cookie headers from an HTTP response and convert them into an array of cookie objects with TypeScript type definitions.

import setCookieParser from 'set-cookie-parser';
import { Cookie } from 'set-cookie-parser';

const setCookieHeader = 'sessionToken=abc123; Path=/; HttpOnly';
const cookies: Cookie[] = setCookieParser.parse(setCookieHeader);

Parsing Set-Cookie headers with options

This feature allows you to parse the Set-Cookie headers with additional options, such as mapping the resulting array into an object keyed by cookie names, while maintaining TypeScript type safety.

import setCookieParser from 'set-cookie-parser';
import { Cookie } from 'set-cookie-parser';

const setCookieHeader = 'sessionToken=abc123; Path=/; HttpOnly';
const options = { map: true };
const cookies: { [cookieName: string]: Cookie } = setCookieParser.parse(setCookieHeader, options);

Splitting Set-Cookie headers

This feature allows you to split a Set-Cookie header string or an array of Set-Cookie header strings into an array of individual cookie strings.

import setCookieParser from 'set-cookie-parser';

const setCookieHeaders = [
  'sessionToken=abc123; Path=/; HttpOnly',
  'userId=12345; Path=/; Secure'
];
const splitCookies: string[] = setCookieParser.splitCookiesString(setCookieHeaders);

Other packages similar to @types/set-cookie-parser

FAQs

Package last updated on 09 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc